home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue46 / packages / PageFormPackage / PageFormU.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1999-05-05  |  2.1 KB  |  80 lines

  1. unit PageFormU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TNewPageForm = class(TForm)
  11.     lblWinPlatform: TLabel;
  12.     lblWinVersion: TLabel;
  13.     lblNTServicePack: TLabel;
  14.     procedure FormCreate(Sender: TObject);
  15.   end;
  16.  
  17. procedure BLRegister;
  18.  
  19. implementation
  20.  
  21. uses
  22.   CommonHookU;
  23.  
  24. {$R *.DFM}
  25.  
  26. type
  27.   TOSVersionInfoEx = record
  28.     dwOSVersionInfoSize: DWORD;
  29.     dwMajorVersion: DWORD;
  30.     dwMinorVersion: DWORD;
  31.     dwBuildNumber: DWORD;
  32.     dwPlatformId: DWORD;
  33.     szCSDVersion: array[0..127] of WideChar; { Maintenance string for PSS usage }
  34.     wServicePackMajor: Word;
  35.     wServicePackMinor: Word;
  36.     wSuiteMask: Word;
  37.     wProductType: Byte;
  38.     wReserved: Byte;
  39.   end;
  40.  
  41. procedure TNewPageForm.FormCreate(Sender: TObject);
  42. var
  43.   OSVI: TOSVersionInfoEx;
  44. begin
  45.   case Win32Platform of
  46.      VER_PLATFORM_WIN32_NT:
  47.         lblWinPlatform.Caption := 'Microsoft Windows NT';
  48.      VER_PLATFORM_WIN32_WINDOWS:
  49.         if (Win32MajorVersion > 4) or
  50.            ((Win32MajorVersion = 4) and (Win32MinorVersion > 0)) then
  51.           lblWinPlatform.Caption := 'Microsoft Windows 98'
  52.         else
  53.           lblWinPlatform.Caption := 'Microsoft Windows 95';
  54.      VER_PLATFORM_WIN32s:
  55.         lblWinPlatform.Caption := 'Win32S on Windows 3.1';
  56.   end;
  57.   lblWinVersion.Caption := Format('Version %d.%d (Build %d: %s)',
  58.      [Win32MajorVersion, Win32MinorVersion,
  59.       Win32BuildNumber and $FFFF, Win32CSDVersion]);
  60.   // Try calling GetVersionEx using the OSVERSIONINFOEX structure,
  61.   // which is supported on Windows 2000 and later.
  62.   // If that fails, we have no service pack information
  63.   FillChar(OSVI, SizeOf(TOSVersionInfoEx), 0);
  64.   OSVI.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx);
  65.   if GetVersionEx(POSVersionInfo(@OSVI)^) then
  66.   begin
  67.     lblWinPlatform.Caption := 'Microsoft Windows 2000';
  68.     lblNTServicePack.Caption := Format('Service Pack %d.%d',
  69.       [OSVI.wServicePackMajor,
  70.        OSVI.wServicePackMinor]);
  71.   end
  72. end;
  73.  
  74. procedure BLRegister;
  75. begin
  76.   RegisterPages('Windows &version', [TNewPageForm.Create(nil)])
  77. end;
  78.  
  79. end.
  80.